package com.tiennt.android.threeview;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AbsoluteLayout;
import android.widget.AbsoluteLayout.LayoutParams;
import android.widget.Button;

@SuppressWarnings("deprecation")
public class FirstView extends Activity {

	AbsoluteLayout mainLayout;
	Button btnA;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initialLayout();
        setupEventHandler();
    }
    
    public void initialLayout(){
    	mainLayout = new AbsoluteLayout(getApplicationContext());
    	setContentView(mainLayout);
    	btnA = new Button(getApplicationContext());
    	btnA.setText("A");
    	btnA.setLayoutParams(new LayoutParams(100, 80, 10, 10));
    	mainLayout.addView(btnA);
    }
    
    public void setupEventHandler(){
    	btnA.setOnClickListener(onBtnAClick);
    }
    
    View.OnClickListener onBtnAClick = new View.OnClickListener() {
		
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent i = new Intent(getApplicationContext(), SecondView.class);
			startActivity(i);
		}
	};
}
